package com.lnkj.spcj.ui.demo


import android.content.Context
import android.os.Bundle
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager

import com.lnkj.spcj.R
import com.lnkj.spcj.base.BaseFragment
import com.lnkj.spcj.util.utilcode.ToastUtils
import kotlinx.android.synthetic.main.fragment_demo.*


/**
 * A simple [Fragment] subclass.
 */
class DemoFragment : BaseFragment<DemoContract.Present>(), DemoContract.View {

    override val mPresenter: DemoContract.Present
        get() = DemoPresent().also { it.attachView(this) }
    override val layoutRes: Int
        get() = R.layout.fragment_demo
    var adapter: DemoAdapter? = null

    companion object {
        fun newInstance(args: Bundle?): DemoFragment {
            val fragment = DemoFragment()
            fragment.arguments = args
            return fragment
        }
    }
    override fun initAll() {
        rv.layoutManager = LinearLayoutManager(mContext)
        adapter = DemoAdapter(arrayListOf())
        adapter?.bindToRecyclerView(rv)
        var list = arrayListOf<DemoBean>()
        list.add(DemoBean())
        list.add(DemoBean())
        list.add(DemoBean())
        list.add(DemoBean())
        list.add(DemoBean())
        list.add(DemoBean())
        list.add(DemoBean())
        list.add(DemoBean())
        list.add(DemoBean())
        list.add(DemoBean())
        adapter?.setNewData(list)
    }

    override fun setListener() {

    }

    override fun processLogic() {

    }


    override fun getContext(): Context {
        return mContext
    }

    override fun onEmpty() {

    }

    override fun onError() {

    }

    override fun indexGoods1(mutableList: MutableList<DemoBean>) {
        ToastUtils.showShort("xxxx")
    }
}
